export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
CURRENT_PATH := $(shell pwd)
KERNELDIR := /home/nixiak/linux/linux_kernel
TFTPDIR := /home/nixiak/linux/tftp

obj-m := led_dtb.o
target := led_dtbAPP

move_file := $(obj-m:.o=.ko) $(target)

build:kernel_modules  APP_file

kernel_modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules

APP_file:$(addsuffix .c,$(target))
	@echo "Compiling APP file ..."
	-@$(CROSS_COMPILE)gcc $< -o $(target)
	@echo "Compilie is ok!"

move:
	@echo "Moving ..."
	cp $(move_file) $(TFTPDIR)
	@echo "Move is ok!"

clean:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
